package com.agranee.timesheet.utility;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;


public class Util {
	public static String encryptInMd5(String toEncrypt) {
		MessageDigest messageDigest = null;

		try {
			messageDigest = MessageDigest.getInstance("MD5");
			byte[] toEnryptInByte = toEncrypt.getBytes();
			messageDigest.reset();
			byte[] digested = messageDigest.digest(toEnryptInByte);
			StringBuffer stringBuffer = new StringBuffer();
			for (int index = 0; index < digested.length; index++) {
				stringBuffer
						.append(Integer.toHexString(0xff & digested[index]));

			}
			return stringBuffer.toString();

		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			//log.error("Error in MD5 method at : " + new Date() + " is : " + e);
			return null;
		}
	}
	
	public void showErrorMessage(){
		
	}
	
	public static boolean sendEmail(String to,String from,String subject,String content){
		return true;
	}

}
